Creating
and Deleting a File
To create a
file, set the dwOpenFlags parameter of the mmioOpen function to MMIO_CREATE.
The following example creates a file and opens it for reading and writing.
HMMIO hFile;
hFile = mmioOpen("NEWFILE.TXT", NULL,
MMIO_CREATE | MMIO_READWRITE);
if (hFile != NULL)
// File
created successfully.
else
// File
cannot be created.
If the file
you are creating already exists, it will be truncated to zero length.
To delete a
file, set the dwOpenFlags parameter of the mmioOpen function to MMIO_DELETE.
After you delete a file, it cannot be recovered by any standard means. If your
application is deleting a file at the request of a user, query the user before
deleting the file to make sure the user wants to delete it.